package cn.nnxy.system.utils;

import com.fasterxml.jackson.databind.util.JSONPObject;

import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author:chenliming
 * @Description:
 * @Date:Created in 16:44 2021-6-1
 * @version:v1.0
 */
public class DataUtil {

    public static <T> Map<String, Object> convertToJsonMap(List<T> datas, Long totalRowCount) {
        Map<String, Object> dataMap = new HashMap<>();
        dataMap.put("rows", datas);
        dataMap.put("total", totalRowCount);
        return dataMap;
    }

    public static void main(String[] args) {
        Map<String, Object> map = DataUtil.convertToJsonMap(Collections.emptyList(), 10l);
        JSONPObject jp = new JSONPObject("ss", map);
        System.out.println("("+map.toString()+")");
    }
}

